package com.xl.teachersystem;

import java.util.List;

import com.example.teachersystem.R;
import com.wmy.teachersystem.ClassActivity;
import com.wmy.teachersystem.ClassListViewAdapter;
import com.wmy.teachersystem.MainActivity;




import android.content.Context;
import android.content.Intent;

import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class GradeListAdapter extends BaseAdapter {
	private List<Grade> classes ;
	private Context context;
	
	public GradeListAdapter(List<Grade> classes, Context context) {
		super();
		this.classes = classes;
		this.context = context;
	}

	@Override
	public int getCount() {
		return classes == null ? 0 : classes.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		View v = LayoutInflater.from(context).inflate(R.layout.item_grade_list, null);
		TextView tv_name = (TextView) v.findViewById(R.id.item_grade_list_name);
		Grade s = classes.get(position);
		tv_name.setText(s.getName());
		
		
		/*v.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(context, ClassActivity.class);
				
				context.startActivity(intent);
				
			}
		});*/
		
	
		
		return v;
	}

	


}
